﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MailDraft.aspx.cs" Inherits="InformationSystem.WebSite.Module.MailMgr.MailDraft" %>

<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script type="text/javascript">
        function callback() {
            parent.ResizeFrameHeight(GridPanel1.getHeight());
            //parent.ResizeFrameHeight(ViewPort1.getHeight(500));
        }
    </script>
    <style type="text/css">
        .x-grid3-cell-inner
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
        }
        
        .x-grid-group-hd div
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
        }
        
        .x-grid3-hd-inner
        {
            font-family: "segoe ui" ,tahoma, arial, sans-serif;
            font-size: 12px;
        }
        
        .x-grid3-body .x-grid3-td-Cost
        {
            background-color: #f1f2f4;
        }
        
        .x-grid3-summary-row .x-grid3-td-Cost
        {
            background-color: #e1e2e4;
        }
        
        .total-field
        {
            background-color: #fff;
            font-weight: bold !important;
            color: #000;
            border: solid 1px silver;
            padding: 2px;
            margin-right: 5px;
        }
    </style>
    <script type="text/javascript">
        var updateTotal = function (grid) {
            var fbar = grid.getBottomToolbar(),
                column,
                field,
                width,
                data = {},
                c,
                cs = grid.view.getColumnData();

            for (var j = 0, jlen = grid.store.getCount(); j < jlen; j++) {
                var r = grid.store.getAt(j);

                for (var i = 0, len = cs.length; i < len; i++) {
                    c = cs[i];
                    column = grid.getColumnModel().columns[i];

                    if (column.summaryType) {
                        data[c.name] = Ext.grid.GroupSummary.Calculations[column.summaryType](data[c.name] || 0, r, c.name, data);
                    }
                }
            }

//            for (var i = 0; i < grid.getColumnModel().columns.length; i++) {
//                column = grid.getColumnModel().columns[i];

//                if (column.dataIndex != grid.store.groupField) {
//                    field = fbar.findBy(function (item) {
//                        return item.dataIndex === column.dataIndex;
//                    })[0];

//                    c = cs[i];
//                    fbar.remove(field, false);
//                    fbar.insert(i, field);
//                    width = grid.getColumnModel().getColumnWidth(i);
//                    field.setWidth(width - 5);
//                    field.setValue((column.summaryRenderer || c.renderer)(data[c.name], {}, {}, 0, i, grid.store));
//                }
//            }

//            fbar.doLayout();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager runat="server">
        <Listeners>
            <DocumentReady Fn="callback()" />
        </Listeners>
    </ext:ResourceManager>
    <ext:GridPanel ID="GridPanel1" runat="server" Frame="true" StripeRows="true" Title="草稿箱"
        AutoExpandColumn="Description" Collapsible="true" AnimCollapse="false" Icon="ApplicationViewColumns"
        TrackMouseOver="false" Width="650" Height="450" ClicksToEdit="1">
        <Store>
            <ext:Store ID="Store1" runat="server" GroupField="Name">
                <SortInfo Direction="DESC" Field="Due" />
                <Reader>
                    <ext:JsonReader IDProperty="TaskID">
                        <Fields>
                            <ext:RecordField Name="ProjectID" />
                            <ext:RecordField Name="Name" />
                            <ext:RecordField Name="TaskID" />
                            <ext:RecordField Name="Description" />
                            <ext:RecordField Name="Estimate" Type="Int" />
                            <ext:RecordField Name="Rate" Type="Float" />
                            <ext:RecordField Name="Due" Type="Date" />
                            <ext:RecordField Name="active" Type="Boolean" />
                            <ext:RecordField Name="ID" Type="Int" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column Header="序号" Width="60" DataIndex="ProjectID" />
                <ext:Column ColumnID="Description" Header="主题" DataIndex="Description"  />
                <ext:DateColumn ColumnID="Due"  Header="时间" DataIndex="Due" />
                <ext:Column  ColumnID="Estimate" Header="收件人" />
            </Columns>

        </ColumnModel>
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Button ID="Button1" runat="server" Text="删除" Icon="Delete" ToolTip="Toggle the visibility of summary row">
                    </ext:Button>
                    <ext:Button ID="Button2" runat="server" Text="刷新" Icon="ArrowRefresh" ToolTip="Toggle the visibility of summary row">
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <SelectionModel>
            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server">
            </ext:CheckboxSelectionModel>
        </SelectionModel>
    </ext:GridPanel>
    </form>
</body>
</html>
